package edu.auctionmart

import edu.auctionmart.ItemCategory
import edu.auctionmart.Item
import grails.test.mixin.*
import org.junit.*

/**
 * See the API for {@link grails.test.mixin.domain.DomainClassUnitTestMixin} for usage instructions
 */
@TestFor(Item)
class ItemTests {

    void testValidation() {
       
		Item item = new Item(name: "Movie", description: "Some movie", category: ItemCategory.Electronics, quantity: 1)
		item.validate()
		assert(item.hasErrors() == false)
		
		item = new Item(name: "Movie", description: "Some movie", category: ItemCategory.Electronics, quantity: -1)
		item.validate()
		assert(item.hasErrors() == true)
		
    }
}
